<?php

/**
 * Solicitud filter form base class.
 *
 * @package    courier
 * @subpackage filter
 * @author     Your name here
 */
abstract class BaseSolicitudFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'sol_estado'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'sol_fecha'              => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'sol_libretarecoleccion' => new sfWidgetFormPropelChoice(array('model' => 'Libretarecoleccion', 'add_empty' => true)),
      'sol_libretaentrega'     => new sfWidgetFormPropelChoice(array('model' => 'Libretaentrega', 'add_empty' => true)),
      'sol_cliente'            => new sfWidgetFormPropelChoice(array('model' => 'Cliente', 'add_empty' => true)),
      'sol_emprecolector'      => new sfWidgetFormPropelChoice(array('model' => 'Empleado', 'add_empty' => true)),
      'sol_empdespachador'     => new sfWidgetFormPropelChoice(array('model' => 'Empleado', 'add_empty' => true)),
      'sol_metodopago'         => new sfWidgetFormPropelChoice(array('model' => 'Metodopago', 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'sol_estado'             => new sfValidatorPass(array('required' => false)),
      'sol_fecha'              => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'sol_libretarecoleccion' => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Libretarecoleccion', 'column' => 'lre_id')),
      'sol_libretaentrega'     => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Libretaentrega', 'column' => 'len_id')),
      'sol_cliente'            => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Cliente', 'column' => 'cli_id')),
      'sol_emprecolector'      => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Empleado', 'column' => 'emp_id')),
      'sol_empdespachador'     => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Empleado', 'column' => 'emp_id')),
      'sol_metodopago'         => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Metodopago', 'column' => 'met_id')),
    ));

    $this->widgetSchema->setNameFormat('solicitud_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Solicitud';
  }

  public function getFields()
  {
    return array(
      'sol_id'                 => 'Number',
      'sol_estado'             => 'Text',
      'sol_fecha'              => 'Date',
      'sol_libretarecoleccion' => 'ForeignKey',
      'sol_libretaentrega'     => 'ForeignKey',
      'sol_cliente'            => 'ForeignKey',
      'sol_emprecolector'      => 'ForeignKey',
      'sol_empdespachador'     => 'ForeignKey',
      'sol_metodopago'         => 'ForeignKey',
    );
  }
}
